package cn.nacos.system;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

/**
 * @Author:ZhouYang
 * @Description:
 * @Date: Created in 2020/8/28 16:57
 * @Modified By：
 */

@EnableDiscoveryClient
//1.配置springboot的包扫描
@SpringBootApplication(scanBasePackages = "cn.nacos")
public class SystemApplication {

    public static void main(String[] args) {
        SpringApplication.run(SystemApplication.class);
    }

    /**
     * 创建服务调用的对象
     *
     * @return
     * @LoadBalanced 添加此注解后，RestTemplate就具有了ribben客户端负载均衡能力
     */
    @Bean
    @LoadBalanced
    public RestTemplate getRestTemplate(){
        return new RestTemplate();
    }
}
